package xy.donate.android.db;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import xy.donate.android.entity.UserLoginEntity;

@Dao
public interface LoginDao {

    //插入
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(UserLoginEntity entity);

    //删除
    @Query("delete from UserLoginEntity where UserID =:userID")
    void deleteLogin(long userID);

    //查询所有
    @Query("select * from UserLoginEntity")
    List<UserLoginEntity> getAll();

    //单个查询
    @Query("select * from UserLoginEntity where UserID =:userID")
    UserLoginEntity queryUser(long userID);

    //手机号查询
    @Query("select * from UserLoginEntity where phone =:Phone")
    UserLoginEntity queryPhone(String Phone);

    //更新数据
    @Update
    void updateUser(UserLoginEntity entity);
}
